//
//  SDApplyInfoController.m
//  SuperDoctor
//
//  Created by fdq on 16/7/6.
//  Copyright © 2016年 SD. All rights reserved.
//

#import "SDApplyInfoController.h"
#import "SDApplyModel.h"
#import "SDApplyCell.h"

@interface SDApplyInfoController ()
@property (nonatomic,strong)UITableView * tableView;

@end

@implementation SDApplyInfoController

- (void)viewDidLoad {
    [super viewDidLoad];
	
	self.view.backgroundColor = [UIColor whiteColor];
	
	self.title = @"预约医生信息详情";
	
	[self setupUI];
}

- (void)setupUI{

	//设置左侧图片
	UIImageView * imgView = [[UIImageView alloc]init];
	
	imgView.image = [UIImage imageNamed:@"illness_img_person.png"];
	
	[self.view addSubview:imgView];
	
	[imgView mas_makeConstraints:^(MASConstraintMaker *make) {
		
		
		make.left.mas_offset(10);
		
		make.width.mas_equalTo(70);
		
		make.height.mas_equalTo(70);
		
		make.top.mas_offset(74);
	}];
	
	imgView.layer.cornerRadius = 35;
	
	imgView.layer.masksToBounds = YES;
	
	//设置右侧预约状态label
	UILabel * rightLabel = [[UILabel alloc]init];
	
	rightLabel.text = self.model.checkState;
	
	rightLabel.backgroundColor = kThemeColor;
	
	if ([rightLabel.text isEqualToString:@"审核失败"]) {
		
		rightLabel.backgroundColor = [UIColor redColor];
		
	}else if([rightLabel.text isEqualToString:@"已就诊"]){
		
		rightLabel.backgroundColor = [UIColor grayColor];
				
	}
	
	rightLabel.textAlignment = NSTextAlignmentCenter;
	
	[self.view addSubview:rightLabel];
	
	[rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
		
		
		make.right.mas_offset(-10);
		
		make.width.mas_equalTo(70);
		
		make.height.mas_equalTo(70);
		
		make.top.mas_offset(74);
	}];
	
	rightLabel.layer.cornerRadius = 35;
	rightLabel.layer.masksToBounds = YES;
	
	//设置第一行的名称
	UILabel * nameLabel = [[UILabel alloc]init];
	
	nameLabel.text = self.model.patientName;
	
	[self.view addSubview:nameLabel];
	
	[nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
	
		
		make.top.mas_offset(74);
		
		make.left.mas_equalTo(imgView.mas_right).mas_offset(10);
		
	}];
	
	//展示病情的label
	UILabel * diseaseLabel = [[UILabel alloc]init];
	
	diseaseLabel.text = self.model.diseaseType;
	
	diseaseLabel.textColor = [UIColor grayColor];
	
	diseaseLabel.font = [UIFont systemFontOfSize:16];
	
	[self.view addSubview:diseaseLabel];
	
	[diseaseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_offset(74);
		
		make.left.mas_equalTo(nameLabel.mas_right).mas_offset(30);
	}];
	
	//展示就诊时间
	UILabel * dateLabel = [[UILabel alloc]init];
	
	dateLabel.text = self.model.time;
	
	[self.view addSubview:dateLabel];
	
	dateLabel.textColor = [UIColor grayColor];
	
	dateLabel.font = [UIFont systemFontOfSize:16];
	
	[dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.left.mas_equalTo(imgView.mas_right).mas_offset(10);
		
		make.bottom.mas_equalTo(imgView.mas_bottom).mas_offset(0);
		
	}];
	
	//设置第一条分割线
	UIView * lineView1 = [[UIView alloc]init];
	
	lineView1.backgroundColor = [UIColor grayColor];
	
	[self.view addSubview:lineView1];
	
	[lineView1 mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(imgView.mas_bottom).mas_offset(10);
		
		make.height.mas_equalTo(1);

		make.width.mas_equalTo(self.view.mas_width);
		
	}];
	
	//设置预约医生
	UILabel * doctorLabel = [[UILabel alloc]init];
	
	doctorLabel.text = @"预约医生:";
	
	doctorLabel.font = [UIFont systemFontOfSize:15];
	
	[self.view addSubview:doctorLabel];
	
	[doctorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(lineView1.mas_bottom).mas_offset(10);
		
		make.left.mas_offset(10);
		
	}];
	
	//设置第二条分割线
	UIView * lineView2 = [[UILabel alloc]init];
	
	lineView2.backgroundColor = [UIColor grayColor];
	
	[self.view addSubview:lineView2];
	
	[lineView2 mas_makeConstraints:^(MASConstraintMaker *make) {
		
		make.top.mas_equalTo(doctorLabel.mas_bottom).mas_offset(10);
		
		make.height.mas_equalTo(1);
		
		make.width.mas_equalTo(self.view.mas_width);
		
	}];
	
	//设置医生信息:姓名
	UILabel * docnameLabel = [[UILabel alloc]init];
	
	docnameLabel.text = self.model.doctorName;
	
	docnameLabel.font = [UIFont systemFontOfSize:15];

	
	[self.view addSubview:docnameLabel];
	
	[docnameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(lineView2.mas_bottom).mas_offset(10);
		
		make.left.mas_offset(10);
		
	}];
	
	//设置主治医生
	UILabel * docTypeLabel = [[UILabel alloc]init];
	
	docTypeLabel.text = self.model.doctorType;
	
	docTypeLabel.textColor = [UIColor grayColor];
	
	docTypeLabel.font = [UIFont systemFontOfSize:14];
	
	[self.view addSubview:docTypeLabel];
	
	[docTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(lineView2.mas_bottom).mas_offset(10);

		make.left.mas_equalTo(docnameLabel.mas_right).mas_offset(30);
	
	}];
	
	//设置医院名称
	UILabel * hospitalName = [[UILabel alloc]init];
	
	hospitalName.text = self.model.hospitalName;
	
	[self.view addSubview:hospitalName];
	
	hospitalName.font = [UIFont systemFontOfSize:15];
	
	[hospitalName mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(docnameLabel.mas_bottom).mas_offset(20);
		
		make.left.mas_offset(10);

	}];
	
	
	//设置第三条分割线
	UIView * lineView3 = [[UILabel alloc]init];
	
	lineView3.backgroundColor = [UIColor grayColor];
	
	[self.view addSubview:lineView3];
	
	[lineView3 mas_makeConstraints:^(MASConstraintMaker *make) {
		
		make.top.mas_equalTo(hospitalName.mas_bottom).mas_offset(10);
		
		make.height.mas_equalTo(1);
		
		make.width.mas_equalTo(self.view.mas_width);
		
	}];
	
	//添加信息按钮
	UIButton * addButton = [[UIButton alloc]init];
	
	[addButton setTitle:@"递交反馈" forState:UIControlStateNormal];
	
	[addButton setBackgroundColor:[UIColor cyanColor]];
	
	addButton.titleLabel.font = [UIFont systemFontOfSize:15];
	
	[self.view addSubview:addButton];
	
	[addButton mas_makeConstraints:^(MASConstraintMaker *make) {
		
		make.right.mas_offset(-10);
		
		make.centerY.mas_equalTo(docTypeLabel.mas_bottom).mas_offset(10);
		
	}];
	
	addButton.layer.cornerRadius = 5;
	
	addButton.layer.masksToBounds = YES;
	
	//设置预约须知
	UILabel * attentionLabel = [[UILabel alloc]init];
	
	[self.view addSubview:attentionLabel];
	
	attentionLabel.text = @"预约须知:";
	
	attentionLabel.font = [UIFont systemFontOfSize:15];

	[attentionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
		
		make.left.mas_offset(10);
		
		make.top.mas_equalTo(lineView3.mas_bottom).mas_offset(10);
		
	}];
	
	//设置第四条分割线
	UIView * lineView4 = [[UILabel alloc]init];
	
	lineView4.backgroundColor = [UIColor grayColor];
	
	[self.view addSubview:lineView4];
	
	[lineView4 mas_makeConstraints:^(MASConstraintMaker *make) {
		
		make.top.mas_equalTo(attentionLabel.mas_bottom).mas_offset(10);
		
		make.height.mas_equalTo(1);
		
		make.width.mas_equalTo(self.view.mas_width);
		
	}];
	
	//设置就诊地点
	UILabel * addressLabel = [[UILabel alloc]init];
	
	[self.view addSubview:addressLabel];
	
	addressLabel.text = @"就诊地点:";
	
	addressLabel.font = [UIFont systemFontOfSize:15];
	
	[addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(lineView4).mas_offset(10);
		
		make.left.mas_offset(10);

	}];
	
	//设置就诊地点信息
	UILabel * addInfoLabel = [[UILabel alloc]init];
	
	[self.view addSubview:addInfoLabel];
	
	addInfoLabel.text = self.model.address;
	
	addInfoLabel.textColor = [UIColor grayColor];
	
	addInfoLabel.font = [UIFont systemFontOfSize:16];
	
	[addInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.left.mas_equalTo(addressLabel.mas_right).mas_offset(10);
		
		make.top.mas_equalTo(lineView4).mas_offset(10);
	}];
	
	//取号时间
	UILabel * takeNotime = [[UILabel alloc]init];
	
	takeNotime.text = @"取号时间:";
	
	[self.view addSubview:takeNotime];
	
	takeNotime.font = [UIFont systemFontOfSize:15];

	[takeNotime mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(addressLabel.mas_bottom).mas_offset(10);
		
		make.left.mas_offset(10);
		
	}];
	
	//时间
	UILabel * timeLabel = [[UILabel alloc]init];
	
	timeLabel.text = @"9:00 - 10:00";
	
	timeLabel.textColor = [UIColor grayColor];
	
	timeLabel.font = [UIFont systemFontOfSize:14];
	
	[self.view addSubview:timeLabel];
	
	[timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(addInfoLabel.mas_bottom).mas_offset(10);
		
		make.left.mas_equalTo(takeNotime.mas_right).mas_offset(10);
	}];
	
	//取号地点
	UILabel * takeNoAddr = [[UILabel alloc]init];
	
	takeNoAddr.text = @"取号地址:";
	
	[self.view addSubview:takeNoAddr];
	
	takeNoAddr.font = [UIFont systemFontOfSize:15];

	[takeNoAddr mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(takeNotime.mas_bottom).mas_offset(10);
		
		make.left.mas_offset(10);
		
	}];
	
	//设置地图图片
	UIImageView * imageView = [[UIImageView alloc]init];
	
	imageView.image = [UIImage imageNamed:@"illness_rb_img_sel.png"];
	
	[self.view addSubview:imageView];
	
	[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(timeLabel.mas_bottom).mas_offset(10);
		
		make.left.mas_equalTo(takeNoAddr.mas_right).mas_offset(10);
	}];
	
	//设置地址信息
	UILabel * addr = [[UILabel alloc]init];
	
	addr.text = @"北京协和医院住院部";
	
	addr.textColor = [UIColor grayColor];
	
	addr.font = [UIFont systemFontOfSize:14];
	
	[self.view addSubview:addr];
	
	[addr mas_makeConstraints:^(MASConstraintMaker *make) {
		
		make.top.mas_equalTo(timeLabel.mas_bottom).mas_offset(10);
		
		make.left.mas_equalTo(imageView.mas_right).mas_offset(10);
	}];
	
	//设置第五条分割线
	UIView * lineView5 = [[UIView alloc]init];
	
	[self.view addSubview:lineView5];
	
	lineView5.backgroundColor = [UIColor grayColor];
	
	[lineView5 mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.top.mas_equalTo(takeNoAddr.mas_bottom).mas_offset(10);
		
		make.height.mas_equalTo(1);
		
		make.width.mas_equalTo(self.view.frame.size.width);
	
	}];
	
	//设置下方按钮,短信重发
	UIButton * mesButton = [[UIButton alloc]init];
	
	[mesButton setTitle:@"短信重发" forState:UIControlStateNormal];
	
	[mesButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
	
	[mesButton setBackgroundImage:[UIImage imageNamed:@"link_button_02"] forState:UIControlStateNormal];
	
	[self.view addSubview:mesButton];
	
	[mesButton mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.bottom.mas_offset(-10);
		
		make.left.mas_offset(10);
		
		make.width.mas_equalTo(self.view.frame.size.width/2 -15);
	}];
	
	//设置下方按钮,取消预约
	UIButton * cancelButton = [[UIButton alloc]init];
	
	[cancelButton setTitle:@"取消预约" forState:UIControlStateNormal];
	
	[cancelButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
	
	[cancelButton setBackgroundImage:[UIImage imageNamed:@"link_button_02"] forState:UIControlStateNormal];
	
	[self.view addSubview:cancelButton];
	
	[cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.bottom.mas_offset(-10);
		
		make.right.mas_offset(-10);
		
		make.width.mas_equalTo(self.view.frame.size.width/2 -15);

	}];
	
	//第六条分割线
	UIView * lineView6 = [[UIView alloc]init];
	
	lineView6.backgroundColor = [UIColor grayColor];
	
	[self.view addSubview:lineView6];
	
	[lineView6 mas_makeConstraints:^(MASConstraintMaker *make) {
	
		make.bottom.mas_equalTo(mesButton.mas_top).mas_offset(-10);
		
		make.height.mas_equalTo(1);
		
		make.width.mas_equalTo(self.view.mas_width);
	}];
	
}

























@end
